package com.reddys.rrp.enrollment.dao;


import org.hibernate.Session;
import org.hibernate.Transaction;

import com.reddys.rrp.enrollment.db.Student;
import com.reddys.rrp.enrollment.util.HibernateUtil;

public class StudentRegistrationDAO {
	
	static Session session ;
	public static Session getSession(){
		HibernateUtil util = new HibernateUtil();
		Session session = util.getSession();
		return session;
	}
	
	public static Student save(Student student){
		try{
		session = getSession();
		Transaction tx = session.beginTransaction();
		tx.begin();
		session.save(student);
		tx.commit();
		session.close();
		}catch(Exception e){
			e.printStackTrace();
		}
		return student;
	}

}
